package cn.junki.corsdemo.config;

import cn.junki.corsdemo.interceptor.CORSInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;


/**
 * WebMvcConfigurer
 *
 * @author Junki
 * @date 2023-09-13 13:35:09
 */
//@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

//    @Resource
//    private CORSInterceptor corsInterceptor;
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(corsInterceptor)
//                .addPathPatterns("/**");
//    }

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**");
    }

}
